package june.circlecontroller;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

public class GameMain extends View{

	private Context context;
	private Paint paint;
	private Bitmap avata;
	private RectF avataRect;
	private float avataX = 300;
	private float avataY = 400;
	
	public GameMain(Context context) {
		super(context);
		this.context = context;
		init();
	}
	
	public GameMain(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.context = context;
		init();
	}

	
	private void init(){
		paint = new Paint();
		avata = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher);
		avataRect = new RectF(avataX, avataY, avataX+avata.getWidth(), avataY+avata.getHeight());
		
	}
	
	public void setAvataPoint(PointF pointF){
		avataX += pointF.x/10;
		avataY += pointF.y/10;
		invalidate();
	}
	
	
	@Override
	public void draw(Canvas canvas) {
		// TODO Auto-generated method stub
		super.draw(canvas);
		
		canvas.drawBitmap(avata, avataX, avataY, paint);
	}
	

}
